<?php

if ( defined('HC_HALO_ENGINE_LOADED') ) {
    throw new Exception("Something has gone horribly wrong. Something has re-imported or re-required the main Halo engine (likely index.php) and that is NOT a good thing!");
}
define('HC_HALO_ENGINE_LOADED', true);

require_once('../bootstraps/bootstrap.php');

hc_core_ClassLoader::load('substrate_Context');
hc_core_ClassLoader::load('halo_DispatcherUtil');
hc_core_ClassLoader::load('dd_configuration_PropertiesConfiguration');

$context = new substrate_Context(array(
    'halo_base.context.php',
    'app.context.php',
    'controllers.context.php'
));

$configuration = $context->get('configuration');

$configuration->import(new dd_configuration_PropertiesConfiguration('site.properties'));

$context->execute();

$dispatcher = $context->get('hc.halo.Dispatcher');

$dispatcher->doService(
    halo_DispatcherUtil::MAKE_HTTP_REQUEST($context),
    halo_DispatcherUtil::MAKE_HTTP_RESPONSE()
);

?>
